all files / lib/ tools.js

100% Statements 11/11
100% Branches 0/0
100% Functions 5/5
100% Lines 11/11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30                                      
var https = require("https");
 
module.exports = {
 
	printName(person) {
		return `${person.last}, ${person.first}`;
	},
 
	loadWiki(person, callback) {
 
		var url = `https://en.wikipedia.org/wiki/${person.first}_${person.last}`;
 
		https.get(url, function(res) {
 
			var body = "";
 
			res.setEncoding("UTF-8");
 
			res.on("data", function(chunk) {
				body += chunk;
			});
 
			res.on("end", function() {
				callback(body);
			});
		});
 
	}
 
};